const { Schema, model } = require("mongoose");

const UserSchema = new Schema({
    __v: { type: Number, select: false },
    username: { type: String, required: true },
    password: { type: String, required: true, select: false },
    avatar: { type: String },
    gender: {
        type: String,
        enum: ["male", "female"],
        default: "male",
        required: true,
    },
    headline: { type: String, select: false },
    locations: { type: [{ type: String }], select: false },
    business: { type: String, select: false },
    employments: {
        type: [
            {
                company: { type: String },
                job: { type: String },
            },
        ],
        select: false,
    },
    following: {
        type: [
            {
                type: Schema.Types.ObjectId,
                ref: "User",
            },
        ],
        select: false,
    },
    followingTopics: {
        type: [
            {
                type: Schema.Types.ObjectId,
                ref: "Topic",
            },
        ],
        select: false,
    },
});

module.exports = model("User", UserSchema);
